﻿using MySchool;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Data.SqlClient;

namespace WinForm2
{
    public partial class Form2 : Form
    {
        public Form2()
        {
            InitializeComponent();
        }

        private void label2_Click(object sender, EventArgs e)
        {

        }

        private void Form2_Load(object sender, EventArgs e)
        {
            //  数据绑定
            DBHelper dBHelper = new DBHelper();
            dBHelper.OpenConnection();

            string sql = "select * from sys_user";
            SqlCommand command = new SqlCommand(sql,dBHelper.Connection);
            SqlDataReader reader = command.ExecuteReader();
            while (reader.Read()) {
                this.comboBox1.Items.Add(reader["username"]);
            }
            reader.Close();
            dBHelper.CloseConnection();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            this.Hide();
        }
    }
}
